package com.rc.saas.tenant.job;

import com.rc.saas.tenant.controller.tenant.ConsoleController;
import com.rc.saas.tenant.model.tenant.Tenant;
import com.rc.saas.tenant.model.tenant.TenantExample;
import com.rc.saas.tenant.search.StatisticsSearch;
import com.rc.saas.tenant.service.elec.ElecStationService;
import com.rc.saas.tenant.service.tenant.ConsoleService;
import com.rc.saas.tenant.service.tenant.TenantService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

public class ConsoleJob {

    @Autowired
    private TenantService tenantService;

    @Autowired
    private ConsoleService consoleService;

    public void run() {

        TenantExample example = new TenantExample();
        example.createCriteria().andStatusEqualTo("0");

        List<Tenant> tenantList = tenantService.selectByExample(example);

        StatisticsSearch search = new StatisticsSearch();
        for (Tenant tenant:tenantList) {
            search.setTenantCode(tenant.getTenantCode());
            search.setBizType("1");

            consoleService.countAllOrder(search);
            consoleService.countTodayOrder(search);
            consoleService.countStation(search);
            consoleService.countGun(search);

        }




    }
}
